package main

import (
	"CheRpc/client"
	"CheRpc/encode"
	"CheRpc/server"
	"CheRpc/test"
	"fmt"
	"sync"
	"time"
)

func init() {
	ser := server.Servers{}
	go ser.StartServer("127.0.0.1:5678")

	time.Sleep(time.Second * 1)
	cli := client.Client{}
	cli.Bind("127.0.0.1:5678")
	cli.Regist(test.IMeg{}, &encode.ResistBody{Add: "127.0.0.1:5678",
		ServerName: "order", StartTime: time.Now(), TimeOut: 5})

	cli2 := client.Client{}

	cli2.Bind("127.0.0.1:5678")
	a := cli2.Call(&encode.CallBody{Agre: []interface{}{int(1221), int(21)},
		Method: "order.TowSum", ContentType: "json"})
	fmt.Println(a)

	var locks sync.WaitGroup
	locks.Add(1)
	locks.Wait()
}

func main() {
}
